package com.xiaohudie.thread;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author xiao hu die
 * @Date 2022/2/21 13:09
 * @Version 1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Account {
    private String name;
    private  Double money;

    public synchronized  void drawMoney(Double money) {

            System.out.println("当前账户的钱为:" + this.getMoney());
            Double afterMoney = this.money - money;
            this.setMoney(afterMoney);
            System.out.println("取款之后的钱为:" + afterMoney);
        }

}
